library RevelationSpawnControl initializer init requires LegacySystem

	globals
		private trigger T
	endglobals
	
	private function RevelationSpawn takes nothing returns nothing
		if (GetPlayerState(Player(13), PLAYER_STATE_RESOURCE_FOOD_USED)<80 and GetPlayerState(Player(14), PLAYER_STATE_RESOURCE_FOOD_USED)<80) then
			call RandomSpawn('n00A',1,GetRandomInt(0, IMaxBJ(3, udg_Spawn) )) //Tartarus
			call GankMarine(Player(13),'n004',udg_Spawn,1000,1800) //Zombie #2
			call RandomSpawn('u005',1,GetRandomInt(0,udg_Spawn)) //Gargolye #2
			call RandomSpawn('n00N',1,GetRandomInt(0,2)) //Mass HP Zombie
		endif

		call SpawnShredder ()

		call TriggerSleepAction(GetRandomReal(0.0,15.0))
		call LightningAmbience.execute()
	endfunction

	function SetRevelationSpawnEnabled takes boolean b returns nothing 
		if b then
			call EnableTrigger(T)
		else
			call DisableTrigger(T)
		endif
	endfunction
	
	private function init2 takes nothing returns nothing
		call PolledWait(1.0)
		set T = CreateTrigger()
		call DisableTrigger( T )
		call TriggerRegisterTimerEventPeriodic(T,59.0*udg_Pace)
		call TriggerAddAction(T,function RevelationSpawn)
	endfunction
	
	private function init takes nothing returns nothing
		call ExecuteFunc(init2.name)
	endfunction

endlibrary